package com.example.newinfinity.Account.MyWorks

import com.example.newinfinity.File.FileManager

/*提供给UserCenterFragment作品中心的recyclerView配置数据*/
fun getImageModel(): ArrayList<WorksModel> {
    val imageModels = arrayListOf<WorksModel>()

    FileManager.instance.getThumbnailImagesPath().forEach { thumbnailPath ->
        //获取文件路径中最后一个斜杠的索引
        val index = thumbnailPath.lastIndexOf("/")
        val name = thumbnailPath.substring(index + 1)
        WorksModel(thumbnailPath, FileManager.instance.getOnlyOriginalPath(name)).apply {
            imageModels.add(this)
        }
    }
    return imageModels
}